#include "comm.hpp"

class Init
{
public:
    Init()
    {
        key = GetKey();
        shmid = CreateShm(key);
        s = (char*)shmat(shmid, nullptr, 0);
    }

    ~Init()
    {
        shmdt(s);
        shmctl(shmid, IPC_RMID, nullptr);
    }
public:
    key_t key;
    int shmid;
    char *s;
};


int main()
{
    Init init;

    struct shmid_ds ds;

    shmctl(init.shmid, IPC_STAT, &ds);

    std::cout << ToHex(ds.shm_perm.__key) << std::endl;
    std::cout << ds.shm_segsz << std::endl;
    std::cout << ds.shm_nattch << std::endl;
    // 你也可以多打印一些属性看看

    return 0;
}